<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link href="<%=basePath %>bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="<%=basePath %>bootstrap/bootstrap-table/dist/extensions/x-editable/bootstrap-editable.css" rel="stylesheet">
    <link href="<%=basePath %>bootstrap/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet"/>
    <script src="<%=basePath %>bootstrap/js/jquery.min.js"></script>
    <script src="<%=basePath %>bootstrap/js/bootstrap.min.js"></script>
    <script src="<%=basePath %>bootstrap/bootstrap-table/dist/extensions/x-editable/bootstrap-editable.min.js"></script>
    <script src="<%=basePath %>bootstrap/bootstrap-table/dist/extensions/x-editable/bootstrap-table.min.js"></script>
    <script src="<%=basePath %>bootstrap/bootstrap-table/dist/extensions/x-editable/bootstrap-table-editable.min.js"></script>
    <script src="<%=basePath %>bootstrap/bootstrap-table/dist/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="<%=basePath %>bootstrap/bootbox/bootbox.min.js"></script>
    <script src="<%=basePath %>bootstrap/commend/initcommend.js"></script>
</head>
<body>
<div class="col-md-12" >
    <table
            id="questiontable"
            data-toggle="table"
            data-url="../question/selectQuestionByPaperId?paperId=${paperId}"
    >
        <thead>
        <tr>
            <th data-field="soreid">序号</th>
            <th data-field="content" >问题</th>
        </tr>
        </thead>
    </table>
</div>
<div class="col-md-12" >
    <div id="toolbar" class="btn-group">
        <button id="btn_save" type="button" class="btn btn-default " data-toggle="modal" data-target="#modalTable" style="margin-right: 10px">
            <span class="glyphicon " aria-hidden="true">提交调查问卷</span>
        </button>

    </div>
    <table
            id="evaltable"
            data-toggle="table"
            data-toolbar="#toolbar"
            data-url="../deptMapper/findEvalDeptListByDeptId?paperId=${paperId}"
    >
        <thead>
        <tr>
            <th data-field="code">科室代码</th>
            <th data-field="name">科室名称</th>
            <c:set var="questionno" value="1" />
            <c:forEach items="${questionList}" var="questionitem">
                <th data-field="question${questionitem.id}" data-editable="true"  data-editable-type="select" data-editable-title="问题${questionno}"
                    data-editable-source="../gradeScore/selectAllGradeScores" >问题${questionno}</th>
                <c:set var="index" value="${index+1}" />
            </c:forEach>
            <th data-field="context" data-editable="true" data-editable-type="text" data-editable-title="说明">说明</th>
        </tr>
        </thead>
    </table>
</div>
</body>
<script>
    $(function() {
        $('#evaltable').bootstrapTable()
        $("#btn_save").on('click',function () {
            $.post(getRootPath_web()+"/evalmaster/submitEvalMaster",{
                evalmasterjson:JSON.stringify($("#evaltable").bootstrapTable("getData")),
                paperId:${paperId},
                cycledate:'${cycledate}'
            },function (data) {
                if (data){
                    bootbox.alert("添加成功");
                } else{
                    bootbox.alert("添加失败");
                }
            },'json')
        })
    })


</script>
</html>
